package com.example.demo.comfig;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:龙宝
 * Date:2023-11-18
 * Time:16:55
 */
@Configuration
@EnableWebSocket
public class ChatConfig implements WebSocketConfigurer {
    @Autowired
    private WebSocketDemo demo;
    @Override
    public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
        //设置webSocket服务器地址：ws://localhost:8080/testAPI
        registry.addHandler(demo,"/testAPI");
    }
}
